var app = getApp();
const util = require('../../../utils/util.js');
const user = require('../../../services/user.js');
Page({
  data: {
    isLogin:false,
    headerSrc: '',
    userInfo:'',
    collectList:[]
  },
  onShow: function () {
    let token = wx.getStorageSync('token')
    if (token){
      this.setData({
        isLogin:true
      })
      this.getcollectionlist()
    } else {
      wx.navigateTo({
        url: '../../login/login',
      })
    }
  },
  getcollectionlist:function(){
    let that = this;
    util.request('collect/getlist', {}, 'GET').then(function (res) {
      console.log(res.data);
      if (res.errno === 0) {
        that.setData({
          collectList: res.data
        })
      }
    });
  },
  switchIndex(e) {
    wx.switchTab({
      url: '/pages/index/index'
    })
  },
  goClass(e){
    console.log(e.currentTarget.dataset.lessonid)
    wx.navigateTo({
      url: '/pages/lessoninfo/lessoninfo?id=' + e.currentTarget.dataset.lessonid
    })
  }
})